using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public static class GameObjectUtil 
{
    public static T GetOrAddComponent<T>(this GameObject go) where T : Component
    {
        var b = go.TryGetComponent<T>(out var comp);
        if(b)
        {
            return comp;
        }
        var newComp = go.AddComponent<T>();
        return newComp;
    }

}
